﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Data.Objects;
using Model;

namespace Configuration.ModelConfiguration
{
    public class ImageConfiguration : EntityConfiguration<Image>
    {
        public ImageConfiguration()
        {
            Property(c => c.Id).IsIdentity();
            Property(c => c.Url).HasMaxLength(500).IsRequired();
            Property(c => c.IsAvatar);

            Relationship(c => c.Product).IsOptional();
            Relationship(c => c.Product).FromProperty(e => e.Images);
        }
    }
}
